<script type="text/javascript"
     src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
</script>

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<head>
    <link rel="stylesheet" href="stylesheet_TMATS.css">
</head>

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<title>
    T-MATS: Help for Set Ps (Cantera) Library Block
</title>

<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<body>
    <h1>
      T-MATS: Set Ps (Cantera) Library Block
    </h1>
<hr>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<div class="purpose">
        Purpose
</div>

<p>
    This block is used to set the static conditions based on flow and
    static pressure. Note: total values will remain the same.
</p>

<br>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<div class="background">
        Background
</div>
<p>
    To compute the output parameters, this block utilizes a Cantera function
    (set_Ps) to set the static pressure of the flow to the input value.
    The phase of the flow is then determined and the other flow parameters
    are internally determined.
</p>
<p>
    It is important to note that if the input static pressure is greater than
    the input total temperature, the block will automatically set the static
    pressure to the value of the total pressure instead. A warning will
    display to notify the user that this has occurred.
</p>
<p>
    To utilize this block, a Cantera object must exist in the workspace as
	a global variable named 'fs', which may be created with the Cantera
	'importPhase' command. This variable must include all Species defined
    in the file 'canteraload.m', found at ...\TMATS_Library\MATLAB_Scripts\Cantera_Enabled\+TMATSC.
</p>
<p>
Example MATLAB setup command:
<code>
	<br>global fs
	<br>fs = importPhase('gri30.cti')
</code>
</p>
<br>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<div class="instructions">
        Instructions
</div>

<p>
    To use this block:
    <ul>
        <li> Connect the input flow and static pressure variables to the
        corresponding places on the block.
        <li> Connect the outputs to the next blocks in the simulation.
    </ul>
</p>


<br><hr><br>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<div class="inputs">
        Set Ps (Cantera) Inputs
</div>

<table>
    <tr><th> Input </th><th>Description</th></tr>
    <tr><td>Flow In</td><td>Input Flow, 25x1 vector consisting of:
            <br>-1- &nbsp;&nbsp;  W   &nbsp;&nbsp;     - Gas path flow [pps]
            <br>-2-  &nbsp;&nbsp; s    &nbsp;&nbsp;   - Entropy [BTU/(lbm*degR)]
            <br>-3- &nbsp;&nbsp;  Tt   &nbsp;&nbsp;    - Total temperature [degR]
            <br>-4- &nbsp;&nbsp;  Pt   &nbsp;&nbsp;    - Total pressure [psia]
            <br>-5-  &nbsp;&nbsp; ht    &nbsp;&nbsp;   - Total enthlapy [BTU/lbm]
            <br>-6-  &nbsp;&nbsp; rhot   &nbsp;&nbsp; - Total density [lbm/ft3]
            <br>-7- &nbsp;&nbsp;  gamt  &nbsp;&nbsp;  - Total specific heat ratio
            <br>-8-  &nbsp;&nbsp; Ts    &nbsp;&nbsp;  - Static temperature [degR]
            <br>-9- &nbsp;&nbsp;  Ps    &nbsp;&nbsp;  - Static pressure [psia]
            <br>-10- &nbsp;&nbsp;  hs   &nbsp;&nbsp;   - Static enthalpy [BTU/lbm]
            <br>-11-  &nbsp;&nbsp; rhos  &nbsp;&nbsp;  - Static density [lbm/ft3]
            <br>-12- &nbsp;&nbsp;  gams  &nbsp;&nbsp;  - Static specific heat ratio
            <br>-13-  &nbsp;&nbsp; Vflow  &nbsp;&nbsp; - Flow velocity [ft/sec]
            <br>-14-  &nbsp;&nbsp; MN   &nbsp;&nbsp; - Mach number
            <br>-15- &nbsp;&nbsp;  A    &nbsp;&nbsp;   - Flow area [in2]
            <br>-16to21- &nbsp;&nbsp; Species array values, defined in canteraload.m
            <br>-22to25- &nbsp;&nbsp; Future use
    </td></tr>
    <tr><td>Ps</td><td>New static pressure [psia]
    </td></tr>
</table>

<br><br>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<div class="outputs">
        Set Ps (Cantera) Outputs
</div>

<table>
    <tr><th> Output </th><th> Description </th></tr>
        <tr><td>Flow Out</td><td>Flow Data Output, 25x1 vector consisting of:
            <br>-1-  &nbsp;&nbsp;  W     &nbsp;&nbsp;   - Gas path flow [pps]
            <br>-2-  &nbsp;&nbsp; s     &nbsp;&nbsp;  - Entropy [BTU/(lbm*degR)]
            <br>-3- &nbsp;&nbsp;  Tt   &nbsp;&nbsp;    - Total temperature [degR]
            <br>-4-  &nbsp;&nbsp; Pt    &nbsp;&nbsp;   - Total pressure [psia]
            <br>-5-  &nbsp;&nbsp; ht    &nbsp;&nbsp;   - Total enthlapy [BTU/lbm]
            <br>-6-  &nbsp;&nbsp; rhot  &nbsp;&nbsp;  - Total density [lbm/ft3]
            <br>-7-  &nbsp;&nbsp; gamt  &nbsp;&nbsp;  - Total specific heat ratio
            <br>-8- &nbsp;&nbsp;  Ts    &nbsp;&nbsp;  - Static temperature [degR]
            <br>-9-  &nbsp;&nbsp; Ps    &nbsp;&nbsp;  - Static pressure [psia]
            <br>-10-  &nbsp;&nbsp; hs    &nbsp;&nbsp;  - Static enthalpy [BTU/lbm]
            <br>-11-  &nbsp;&nbsp; rhos  - Static density [lbm/ft3]
            <br>-12- &nbsp;&nbsp;  gams  &nbsp;&nbsp;  - Static specific heat ratio
            <br>-13- &nbsp;&nbsp;  Vflow &nbsp;&nbsp;  - Flow velocity [ft/sec]
            <br>-14-  &nbsp;&nbsp; MN   &nbsp;&nbsp; - Mach number
            <br>-15-  &nbsp;&nbsp; A    &nbsp;&nbsp;   - Flow area [in2]
            <br>-16to21- &nbsp;&nbsp;  Species array values, defined in canteraload.m
            <br>-22to25-  &nbsp;&nbsp; Future use
    </td></tr>
    <tr><td>sPs_Data</td><td>Block additional calculation data, 1x1 vector including:
    <br>- 0 - Future use</td></tr>
</table>

<br><br>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<div class="maskvars">
        Set Ps (Cantera) Mask Variables
</div>

<p>
    No mask variables are needed for this block, since all of the calculations
    depend only on the inputs.
</p>


<br><hr><br>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->

<div class = "errors">
    Potential Errors
</div>
<p>
When using this block, you may receive one of the following errors/warnings. The table
below lists the errors/warnings that you may see and the reason why it is being displayed.
</p>
<table>
    <tr><th> Error/Warning </th><th>Description</th></tr>
    <tr><td> Input Ps is greater than input Pt. </td><td> The input static
    pressure is greater than the input total pressure. Block will automatically
    adjust such that Ps = Pt.</td></tr>
</table>
<p>
    Additionally, an error will occur if a Cantera object does not exist
    in the workspace as a global variable named 'fs'. An error will also occur
    if this variable does not contain all of the species defined in 'canteraload.m'.
</p>



<br><br>
<!-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
</body>